﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects;

namespace Xyz.Framework.Server.DataAcessLayer
{
    public class DataBaseContext : IDisposable
    {
        private DataObjectContext _context;
        public DataBaseContext(string connectionstring, string containername)
        {
            if (_context == null)
                _context = new DataObjectContext(connectionstring, containername);
        }

        public ObjectSet<TEntity> CreateObjectSet<TEntity>()
         where TEntity : class
        {
            return _context.CreateObjectSet<TEntity>();
        }
        public int SaveChanges()
        {
            return _context.SaveChanges();

        }

        public void Dispose()
        {
            _context.Dispose();
        }







    }
}
